<template>
  <div class="search">
    <f-form ref="form" :action="api.recDeliReq" :form-key="this.formItem.undefined" >
      <f-form-item label="项目ID"  name="projectId"    :value="formItem.projectId" />
      <f-form-item label="项目编码"  name="projectCode"    :value="formItem.projectCode" />
      <f-form-item label="项目名称"  name="projectName"    :value="formItem.projectName" />
      <f-form-item label="操作用户"  name="userId"    :value="formItem.userId" />
      <f-form-item label=""  name="userName"    :value="formItem.userName" />
      <f-form-item label="创建时间" type="date" name="createTime"    :value="formItem.createTime" />
      <f-form-item label="本次采购数量"  name="purchaseNum"    :value="formItem.purchaseNum" />
      <f-form-item label="在途数量"  name="onLineNum"    :value="formItem.onLineNum" />
      <f-form-item label="到货数量"  name="receiveNum"    :value="formItem.receiveNum" />
      <f-form-item label="需求计划日期" type="date" name="receivedDate"    :value="formItem.receivedDate" />
      <f-form-item label=""  name="vendorId"    :value="formItem.vendorId" />
      <f-form-item label="供应商编码"  name="supplierCode"    :value="formItem.supplierCode" />
      <f-form-item label="供应商名称"  name="supplierName"    :value="formItem.supplierName" />
      <f-form-item label="预留号"  name="reserveNo"    :value="formItem.reserveNo" />
      <f-form-item label="预留行号"  name="reserveRow" dataType="number"   :value="formItem.reserveRow" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'brdvForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          undefined: '',
          projectId: '',
          projectCode: '',
          projectName: '',
          userId: '',
          userName: '',
          createTime: '',
          purchaseNum: '',
          onLineNum: '',
          receiveNum: '',
          receivedDate: '',
          vendorId: '',
          supplierCode: '',
          supplierName: '',
          reserveNo: '',
          reserveRow: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.undefined) {
          let params={
              undefined:data.undefined
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
